import request from "./service";

// 登录
export const fetchUsersLogin = async (data: any) => {
  const res = await request.post("/users/login", data);
  return res;
};

// 获取医疗药品
export const fetchDrugsList = async (params: any) => {
  const res = await request.get("/drugs/list", params);
  return res;
};

// 删除
export const fetchDrugsDelete = async (id: number) => {
  const res = await request.get(`/drugs/del?id=${id}`);
  return res;
};

// 搜索
export const fetchDrugsSearch = async (params: any) => {
  const res = await request.get("/drugs/search", params);
  return res;
};

// 修改
export const fetchDrugsEdit = async (data: any) => {
  const res = await request.get("/drugs/edit", data);
  return res;
};

// 批量删除
export const fetchAllDel = async (data: any) => {
  const res = await request.post("/drugs/batchdel?", data);
  return res;
};

// 添加
export const fetchDrugsAdd = async (data: any) => {
  const res = await request.post("/drugs/add", data);
  return res;
};

// 处方
export const fetchRecipelList = async (data: any) => {
  const res = await request.get("/recipel/list", data);
  return res;
};

// 添加
export const fetchRecipelAdd = async (data: any) => {
  const res = await request.post("/recipel/add", data);
  return res;
};

// 删除
export const fetchRecipelDelete = async (id: any) => {
  const res = await request.get("/recipel/del", id);
  return res;
};

//批量删除
export const fetchRecipelAllDel = async (data: any) => {
  const res = await request.post("/recipel/batchdel", data);
  return res;
};

// 详情
export const fetchRecipelDetail = async (data: any) => {
  const res = await request.get("/recipel/infobyid", data);
  return res;
};

// Echart数据
export const fetchEchartData = async (data: any) => {
  const res = await request.get("/infomationcenter/drugs", data);
  return res;
};

// 所有医生 http://www.bingo1440.top:21001/doctor/doctornames
export const fetchAllDoctor = async () => {
  const res = await request.get("/doctor/doctornames");
  return res;
};
